package com.godGuang.file.uploadType;

import com.godGuang.file.service.ISysFileService;
import com.godGuang.file.service.impl.FastDfsSysFileServiceImpl;
import com.godGuang.file.service.impl.LocalSysFileServiceImpl;
import com.godGuang.file.service.impl.MinioSysFileServiceImpl;
import com.godGuang.file.service.impl.OssSysFileServiceImpl;
import com.godGuang.file.uplpadEnum.FileEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: godGuang
 * @description:
 * @author: godGuang
 * @create: 2024-01-08 15:32
 **/
@Component
public class FileService {
    @Autowired
    private LocalSysFileServiceImpl localSysFileService;

    @Autowired
    private FastDfsSysFileServiceImpl fastDfsSysFileService;

    @Autowired
    private OssSysFileServiceImpl ossSysFileService;

    @Autowired
    private MinioSysFileServiceImpl minioSysFileService;

    public ISysFileService instance (Integer type) {
        FileEnum anEnum = FileEnum.getEnum(type);
        switch (anEnum) {
            case LOCAL:
                return localSysFileService;
            case FASTDFS:
                return fastDfsSysFileService;
            case OSS:
                return ossSysFileService;
            case MINIO:
                return minioSysFileService;
            default:
                return ossSysFileService;
        }
    }
}

